package org.example.springbootdemo;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;

@RequestMapping("/cont")
@Controller
public class Controllertset {
    @RequestMapping("/test")
    public String htmltest(){
        return "/index.html";
    }
    @RequestMapping("/body")
    @ResponseBody
    public String body(){
        return  "这是一次测试";
    }
    @RequestMapping("/body2")
    @ResponseBody
    public String body2(){
        return "<h1>我是ResponseBody类型的</h1>";
    }
    @RequestMapping("/getMap")
    @ResponseBody
    public HashMap<String,String> getMap(){
        HashMap<String,String> map = new HashMap<>();
        map.put("a1","A1");
        map.put("a2","A2");
        return map;
    }
}
